package com.zxjbyte.yiyi.framework.common.domain.api;

/**
 * @Author zhangxingjia
 * @Date 2023/2/27 17:42
 * @Version: 1.0
 */
public enum ResultCode implements IResultCode {

    SUCCESS(1, "操作成功"),

    /* 参数错误 1001-1099 */
    PARAM_MISS(1001, "缺少必要的请求参数"),
    PARAM_TYPE_ERROR(1002, "请求参数类型错误"),
    PARAM_BIND_ERROR(1003, "请求参数绑定错误"),
    PARAM_VALID_ERROR(1004, "参数校验失败"),

    /* 请求系统异常 1101-1199 */
    UN_AUTHORIZED(1101, "请求未授权"),
    CLIENT_UN_AUTHORIZED(1102, "客户端请求未授权"),
    NOT_FOUND(1103, "404 没找到请求"),
    MSG_NOT_READABLE(1104, "消息不能读取"),
    METHOD_NOT_SUPPORTED(1105, "不支持当前请求方法"),
    MEDIA_TYPE_NOT_SUPPORTED(1106, "不支持当前媒体类型"),
    REQ_REJECT(1107, "请求被拒绝"),
    INTERNAL_SERVER_ERROR(1108, "服务器异常")

    /* 业务异常 2001-2099 */,
    FAILURE(2001, "业务异常")
    ;

    final int code;
    final String message;

    public int getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    ResultCode(final int code, final String message) {
        this.code = code;
        this.message = message;
    }
}
